package com.etc.delivery.service.admin.impl;

import com.etc.delivery.dao.admin.AdminDriverDao;
import com.etc.delivery.dto.DriverDto;
import com.etc.delivery.entity.Waybill;
import com.etc.delivery.service.admin.IAdminDriverService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AdminDriverServiceImpl implements IAdminDriverService {

    @Resource
    private AdminDriverDao driverDao;

    @Override
    public PageInfo<DriverDto> queryDriver(String name, Integer warehouseId, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<DriverDto> list = driverDao.queryDriver(name, warehouseId);
        PageInfo pageInfo = new PageInfo<>(list);

        return pageInfo;
    }

    @Override
    public boolean deleteDriver(Integer id) {
        return driverDao.deleteDriver(id);
    }

    @Override
    public List<Waybill> queryDriverWaybill(Integer driverId) {
        return driverDao.queryDriverWaybill(driverId);
    }


}
